package bpm.dao.impl.user;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import bpm.domain.user.OrgGroup;
import bpm.domain.user.OrgGroupType;
/**
 * 
 * @author ZhaoWangLong Jul 25, 2011
 *
 */
public class OrgGroupViewRowMapper implements RowMapper {

	public Object mapRow(ResultSet rs, int i) throws SQLException {
		OrgGroup group=new OrgGroup();
		group.setId(rs.getString("ID"));
		group.setSortIndex(rs.getInt("SORTINDEX"));
		group.setName(rs.getString("NAME"));
		OrgGroup pGroup=new OrgGroup();
		pGroup.setId(rs.getString("PARENTID"));
		pGroup.setName(rs.getString("PNAME"));
		group.setPOrgGroup(pGroup);
		OrgGroupType type=new OrgGroupType();
		type.setId(rs.getString("GROUPTYPEID"));
		group.setGroupType(type);
		group.setOwner(rs.getString("OWNER"));
		group.setAttr1(rs.getString("ATTR1"));
		group.setDelete("1".equals(rs.getString("ATTR2").trim())?true:false);
		String preGroup=rs.getString("ATTR3");
		group.setAttr3(preGroup);
		return group;
	}

}
